package org.linlinjava.litemall.db.domain;

import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;

public class BusinessResult {
    private String resId;

    private String resYear;

    private String resName;

    private String resAuthAgency;

    private String resType;

    private Integer resLevel;

    private String resLevelInfo;

    private String resMark;

    private LocalDate resFinishDate;

    private LocalDate resPassDate;

    private String resReserve1;

    private String resReserve2;

    private String resReserve3;

    private String resWithProjectId;

    private String resWithProjectName;

    private String dutyPersonalName;

    private String resFilesName;

    private String resRemark;

    private Integer statusAudit;

    private String backupRemark;

    private Integer owningModule;

    private String owningModuleName;

    private String adminName;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime insertTime;

    private String updateAdminName;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    public String getResId() {
        return resId;
    }

    public void setResId(String resId) {
        this.resId = resId;
    }

    public String getResYear() {
        return resYear;
    }

    public void setResYear(String resYear) {
        this.resYear = resYear;
    }

    public String getResName() {
        return resName;
    }

    public void setResName(String resName) {
        this.resName = resName;
    }

    public String getResAuthAgency() {
        return resAuthAgency;
    }

    public void setResAuthAgency(String resAuthAgency) {
        this.resAuthAgency = resAuthAgency;
    }

    public String getResType() {
        return resType;
    }

    public void setResType(String resType) {
        this.resType = resType;
    }

    public Integer getResLevel() {
        return resLevel;
    }

    public void setResLevel(Integer resLevel) {
        this.resLevel = resLevel;
    }

    public String getResLevelInfo() {
        return resLevelInfo;
    }

    public void setResLevelInfo(String resLevelInfo) {
        this.resLevelInfo = resLevelInfo;
    }

    public String getResMark() {
        return resMark;
    }

    public void setResMark(String resMark) {
        this.resMark = resMark;
    }

    public LocalDate getResFinishDate() {
        return resFinishDate;
    }

    public void setResFinishDate(LocalDate resFinishDate) {
        this.resFinishDate = resFinishDate;
    }

    public LocalDate getResPassDate() {
        return resPassDate;
    }

    public void setResPassDate(LocalDate resPassDate) {
        this.resPassDate = resPassDate;
    }

    public String getResReserve1() {
        return resReserve1;
    }

    public void setResReserve1(String resReserve1) {
        this.resReserve1 = resReserve1;
    }

    public String getResReserve2() {
        return resReserve2;
    }

    public void setResReserve2(String resReserve2) {
        this.resReserve2 = resReserve2;
    }

    public String getResReserve3() {
        return resReserve3;
    }

    public void setResReserve3(String resReserve3) {
        this.resReserve3 = resReserve3;
    }

    public String getResWithProjectId() {
        return resWithProjectId;
    }

    public void setResWithProjectId(String resWithProjectId) {
        this.resWithProjectId = resWithProjectId;
    }

    public String getResWithProjectName() {
        return resWithProjectName;
    }

    public void setResWithProjectName(String resWithProjectName) {
        this.resWithProjectName = resWithProjectName;
    }

    public String getDutyPersonalName() {
        return dutyPersonalName;
    }

    public void setDutyPersonalName(String dutyPersonalName) {
        this.dutyPersonalName = dutyPersonalName;
    }

    public String getResFilesName() {
        return resFilesName;
    }

    public void setResFilesName(String resFilesName) {
        this.resFilesName = resFilesName;
    }

    public String getResRemark() {
        return resRemark;
    }

    public void setResRemark(String resRemark) {
        this.resRemark = resRemark;
    }

    public Integer getStatusAudit() {
        return statusAudit;
    }

    public void setStatusAudit(Integer statusAudit) {
        this.statusAudit = statusAudit;
    }

    public String getBackupRemark() {
        return backupRemark;
    }

    public void setBackupRemark(String backupRemark) {
        this.backupRemark = backupRemark;
    }

    public Integer getOwningModule() {
        return owningModule;
    }

    public void setOwningModule(Integer owningModule) {
        this.owningModule = owningModule;
    }

    public String getOwningModuleName() {
        return owningModuleName;
    }

    public void setOwningModuleName(String owningModuleName) {
        this.owningModuleName = owningModuleName;
    }

    public String getAdminName() {
        return adminName;
    }

    public void setAdminName(String adminName) {
        this.adminName = adminName;
    }

    public LocalDateTime getInsertTime() {
        return insertTime;
    }

    public void setInsertTime(LocalDateTime insertTime) {
        this.insertTime = insertTime;
    }

    public String getUpdateAdminName() {
        return updateAdminName;
    }

    public void setUpdateAdminName(String updateAdminName) {
        this.updateAdminName = updateAdminName;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", resId=").append(resId);
        sb.append(", resYear=").append(resYear);
        sb.append(", resName=").append(resName);
        sb.append(", resAuthAgency=").append(resAuthAgency);
        sb.append(", resType=").append(resType);
        sb.append(", resLevel=").append(resLevel);
        sb.append(", resLevelInfo=").append(resLevelInfo);
        sb.append(", resMark=").append(resMark);
        sb.append(", resFinishDate=").append(resFinishDate);
        sb.append(", resPassDate=").append(resPassDate);
        sb.append(", resReserve1=").append(resReserve1);
        sb.append(", resReserve2=").append(resReserve2);
        sb.append(", resReserve3=").append(resReserve3);
        sb.append(", resWithProjectId=").append(resWithProjectId);
        sb.append(", resWithProjectName=").append(resWithProjectName);
        sb.append(", dutyPersonalName=").append(dutyPersonalName);
        sb.append(", resFilesName=").append(resFilesName);
        sb.append(", resRemark=").append(resRemark);
        sb.append(", statusAudit=").append(statusAudit);
        sb.append(", backupRemark=").append(backupRemark);
        sb.append(", owningModule=").append(owningModule);
        sb.append(", owningModuleName=").append(owningModuleName);
        sb.append(", adminName=").append(adminName);
        sb.append(", insertTime=").append(insertTime);
        sb.append(", updateAdminName=").append(updateAdminName);
        sb.append(", updateTime=").append(updateTime);
        sb.append("]");
        return sb.toString();
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        BusinessResult other = (BusinessResult) that;
        return (this.getResId() == null ? other.getResId() == null : this.getResId().equals(other.getResId()))
            && (this.getResYear() == null ? other.getResYear() == null : this.getResYear().equals(other.getResYear()))
            && (this.getResName() == null ? other.getResName() == null : this.getResName().equals(other.getResName()))
            && (this.getResAuthAgency() == null ? other.getResAuthAgency() == null : this.getResAuthAgency().equals(other.getResAuthAgency()))
            && (this.getResType() == null ? other.getResType() == null : this.getResType().equals(other.getResType()))
            && (this.getResLevel() == null ? other.getResLevel() == null : this.getResLevel().equals(other.getResLevel()))
            && (this.getResLevelInfo() == null ? other.getResLevelInfo() == null : this.getResLevelInfo().equals(other.getResLevelInfo()))
            && (this.getResMark() == null ? other.getResMark() == null : this.getResMark().equals(other.getResMark()))
            && (this.getResFinishDate() == null ? other.getResFinishDate() == null : this.getResFinishDate().equals(other.getResFinishDate()))
            && (this.getResPassDate() == null ? other.getResPassDate() == null : this.getResPassDate().equals(other.getResPassDate()))
            && (this.getResReserve1() == null ? other.getResReserve1() == null : this.getResReserve1().equals(other.getResReserve1()))
            && (this.getResReserve2() == null ? other.getResReserve2() == null : this.getResReserve2().equals(other.getResReserve2()))
            && (this.getResReserve3() == null ? other.getResReserve3() == null : this.getResReserve3().equals(other.getResReserve3()))
            && (this.getResWithProjectId() == null ? other.getResWithProjectId() == null : this.getResWithProjectId().equals(other.getResWithProjectId()))
            && (this.getResWithProjectName() == null ? other.getResWithProjectName() == null : this.getResWithProjectName().equals(other.getResWithProjectName()))
            && (this.getDutyPersonalName() == null ? other.getDutyPersonalName() == null : this.getDutyPersonalName().equals(other.getDutyPersonalName()))
            && (this.getResFilesName() == null ? other.getResFilesName() == null : this.getResFilesName().equals(other.getResFilesName()))
            && (this.getResRemark() == null ? other.getResRemark() == null : this.getResRemark().equals(other.getResRemark()))
            && (this.getStatusAudit() == null ? other.getStatusAudit() == null : this.getStatusAudit().equals(other.getStatusAudit()))
            && (this.getBackupRemark() == null ? other.getBackupRemark() == null : this.getBackupRemark().equals(other.getBackupRemark()))
            && (this.getOwningModule() == null ? other.getOwningModule() == null : this.getOwningModule().equals(other.getOwningModule()))
            && (this.getOwningModuleName() == null ? other.getOwningModuleName() == null : this.getOwningModuleName().equals(other.getOwningModuleName()))
            && (this.getAdminName() == null ? other.getAdminName() == null : this.getAdminName().equals(other.getAdminName()))
            && (this.getInsertTime() == null ? other.getInsertTime() == null : this.getInsertTime().equals(other.getInsertTime()))
            && (this.getUpdateAdminName() == null ? other.getUpdateAdminName() == null : this.getUpdateAdminName().equals(other.getUpdateAdminName()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getResId() == null) ? 0 : getResId().hashCode());
        result = prime * result + ((getResYear() == null) ? 0 : getResYear().hashCode());
        result = prime * result + ((getResName() == null) ? 0 : getResName().hashCode());
        result = prime * result + ((getResAuthAgency() == null) ? 0 : getResAuthAgency().hashCode());
        result = prime * result + ((getResType() == null) ? 0 : getResType().hashCode());
        result = prime * result + ((getResLevel() == null) ? 0 : getResLevel().hashCode());
        result = prime * result + ((getResLevelInfo() == null) ? 0 : getResLevelInfo().hashCode());
        result = prime * result + ((getResMark() == null) ? 0 : getResMark().hashCode());
        result = prime * result + ((getResFinishDate() == null) ? 0 : getResFinishDate().hashCode());
        result = prime * result + ((getResPassDate() == null) ? 0 : getResPassDate().hashCode());
        result = prime * result + ((getResReserve1() == null) ? 0 : getResReserve1().hashCode());
        result = prime * result + ((getResReserve2() == null) ? 0 : getResReserve2().hashCode());
        result = prime * result + ((getResReserve3() == null) ? 0 : getResReserve3().hashCode());
        result = prime * result + ((getResWithProjectId() == null) ? 0 : getResWithProjectId().hashCode());
        result = prime * result + ((getResWithProjectName() == null) ? 0 : getResWithProjectName().hashCode());
        result = prime * result + ((getDutyPersonalName() == null) ? 0 : getDutyPersonalName().hashCode());
        result = prime * result + ((getResFilesName() == null) ? 0 : getResFilesName().hashCode());
        result = prime * result + ((getResRemark() == null) ? 0 : getResRemark().hashCode());
        result = prime * result + ((getStatusAudit() == null) ? 0 : getStatusAudit().hashCode());
        result = prime * result + ((getBackupRemark() == null) ? 0 : getBackupRemark().hashCode());
        result = prime * result + ((getOwningModule() == null) ? 0 : getOwningModule().hashCode());
        result = prime * result + ((getOwningModuleName() == null) ? 0 : getOwningModuleName().hashCode());
        result = prime * result + ((getAdminName() == null) ? 0 : getAdminName().hashCode());
        result = prime * result + ((getInsertTime() == null) ? 0 : getInsertTime().hashCode());
        result = prime * result + ((getUpdateAdminName() == null) ? 0 : getUpdateAdminName().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    public enum Column {
        resId("res_id", "resId", "VARCHAR", false),
        resYear("res_year", "resYear", "VARCHAR", false),
        resName("res_name", "resName", "VARCHAR", false),
        resAuthAgency("res_auth_agency", "resAuthAgency", "VARCHAR", false),
        resType("res_type", "resType", "VARCHAR", false),
        resLevel("res_level", "resLevel", "INTEGER", false),
        resLevelInfo("res_level_info", "resLevelInfo", "VARCHAR", false),
        resMark("res_mark", "resMark", "VARCHAR", false),
        resFinishDate("res_finish_date", "resFinishDate", "DATE", false),
        resPassDate("res_pass_date", "resPassDate", "DATE", false),
        resReserve1("res_reserve1", "resReserve1", "VARCHAR", false),
        resReserve2("res_reserve2", "resReserve2", "VARCHAR", false),
        resReserve3("res_reserve3", "resReserve3", "VARCHAR", false),
        resWithProjectId("res_with_project_id", "resWithProjectId", "VARCHAR", false),
        resWithProjectName("res_with_project_name", "resWithProjectName", "VARCHAR", false),
        dutyPersonalName("duty_personal_name", "dutyPersonalName", "VARCHAR", false),
        resFilesName("res_files_name", "resFilesName", "VARCHAR", false),
        resRemark("res_remark", "resRemark", "VARCHAR", false),
        statusAudit("status_audit", "statusAudit", "INTEGER", false),
        backupRemark("backup_remark", "backupRemark", "VARCHAR", false),
        owningModule("owning_module", "owningModule", "INTEGER", false),
        owningModuleName("owning_module_name", "owningModuleName", "VARCHAR", false),
        adminName("admin_name", "adminName", "VARCHAR", false),
        insertTime("insert_time", "insertTime", "TIMESTAMP", false),
        updateAdminName("update_admin_name", "updateAdminName", "VARCHAR", false),
        updateTime("update_time", "updateTime", "TIMESTAMP", false);

        private static final String BEGINNING_DELIMITER = "`";

        private static final String ENDING_DELIMITER = "`";

        private final String column;

        private final boolean isColumnNameDelimited;

        private final String javaProperty;

        private final String jdbcType;

        public String value() {
            return this.column;
        }

        public String getValue() {
            return this.column;
        }

        public String getJavaProperty() {
            return this.javaProperty;
        }

        public String getJdbcType() {
            return this.jdbcType;
        }

        Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
            this.column = column;
            this.javaProperty = javaProperty;
            this.jdbcType = jdbcType;
            this.isColumnNameDelimited = isColumnNameDelimited;
        }

        public String desc() {
            return this.getEscapedColumnName() + " DESC";
        }

        public String asc() {
            return this.getEscapedColumnName() + " ASC";
        }

        public static Column[] excludes(Column ... excludes) {
            ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
            if (excludes != null && excludes.length > 0) {
                columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
            }
            return columns.toArray(new Column[]{});
        }

        public String getEscapedColumnName() {
            if (this.isColumnNameDelimited) {
                return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
            } else {
                return this.column;
            }
        }

        public String getAliasedEscapedColumnName() {
            return this.getEscapedColumnName();
        }
    }
}